<?php

namespace app\timeapi\controller;

use app\common\timebusiness\User as userBn;
use app\common\business\Match as matchBn;
use app\common\timebusiness\Countdown as countdownBn;
class Home extends \app\common\controller\HomeBase {



    /*
    * 世界杯倒计时
    *
    * */
    public function countdown(){
        try {
            $user_id = $this->_istimeLogin();
            $params['user_id'] = $user_id;

            $data=countdownBn::countdown($params);

            $this->_echoSuccessMessage('success', $data);
        } catch (\Exception $e) {
            $this->_echoErrorMessage($e->getMessage(), $e->getCode());
        }
    }
    /*
    * 世界杯列表
    *
    * */
    public function matchList(){
        try {
            $user_id = $this->_istimeLogin();
            $data=matchBn::matchlist(array());

            $this->_echoSuccessMessage('success', $data);
        } catch (\Exception $e) {
            $this->_echoErrorMessage($e->getMessage(), $e->getCode());
        }
    }
    /*
       * 保存倒计时
       *
       * */
    public function savetime(){
        try {

            $params = input();
            $validate = Validate('Countdown');
            $params = $validate->scene('timeinfo')->check($params);
            if (!$params) {
                exception($validate->getError(), 10000003);
            }
            $params['user_id'] = $this->_validTimeLogin();
            $data=countdownBn::savetime($params);

            $this->_echoSuccessMessage('success', $data);
        } catch (\Exception $e) {
            $this->_echoErrorMessage($e->getMessage(), $e->getCode());
        }
    }

}
